/*    */ package com.zimbra.qa.unittest;
/*    */ 
/*    */ import com.zimbra.cs.db.Db;
/*    */ import com.zimbra.cs.db.DbMailbox;
/*    */ import com.zimbra.cs.db.DbPool;
/*    */ import com.zimbra.cs.db.DbPool.DbConnection;
/*    */ import com.zimbra.cs.db.DbUtil;
/*    */ import com.zimbra.cs.mailbox.Mailbox;
/*    */ import junit.framework.TestCase;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class TestDbUtil
/*    */   extends TestCase
/*    */ {
/*    */   public void testNormalizeSql()
/*    */     throws Exception
/*    */   {
/* 36 */     String sql = " \t SELECT a, 'b', 1, '', ',', NULL, '\\'' FROM table1\n\nWHERE c IN (1, 2, 3) ";
/* 37 */     String normalized = DbUtil.normalizeSql(sql);
/* 38 */     String expected = "SELECT a, XXX, XXX, XXX, XXX, XXX, XXX FROM tableXXX WHERE c IN (...)";
/* 39 */     assertEquals(expected, normalized);
/*    */   }
/*    */   
/*    */   public void testDatabaseExists() throws Exception
/*    */   {
/* 44 */     Mailbox mbox = TestUtil.getMailbox("user1");
/* 45 */     Db db = Db.getInstance();
/* 46 */     String dbName = DbMailbox.getDatabaseName(mbox);
/* 47 */     DbPool.DbConnection conn = DbPool.getConnection();
/*    */     
/* 49 */     assertTrue("Could not find database " + dbName, db.databaseExists(conn, dbName));
/* 50 */     assertFalse("False positive", db.databaseExists(conn, "foobar"));
/*    */     
/* 52 */     DbPool.quietClose(conn);
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/qa/unittest/TestDbUtil.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */